using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using PocketSettings;
using PocketLibrary;

namespace PocketApps
{
    public partial class flickrSettings : Form
    {
        PocketSettings.PocketSettings settings = PocketSettings.PocketSettings.Create();

        public flickrSettings()
        {
            InitializeComponent();
        }

        private void flickrSettings_Load(object sender, EventArgs e)
        {
            // lataa asetukset
            //settings.FromDisk(HelperUtils.ApplicationPath + "settings\\flickr.xml");
            if (settings.SelectedUserProfile.Settings.Get("flickrPreviewSize") != "")
                cbFlickrSize.Text = settings.SelectedUserProfile.Settings.Get("flickrPreviewSize");
            if (settings.SelectedUserProfile.Settings.Get("localPreviewSize") != "")
                cbLocalSize.Text = settings.SelectedUserProfile.Settings.Get("localPreviewSize");
            if (settings.SelectedUserProfile.Settings.Get("flickrDownloadBuddyIcons") != "")
                cbBuddyIcons.Text = settings.SelectedUserProfile.Settings.Get("flickrDownloadBuddyIcons");
        }

        private void flickrSettings_Closing(object sender, CancelEventArgs e)
        {
            settings.SelectedUserProfile.Settings.Add("flickrPreviewSize", cbFlickrSize.Text);
            settings.SelectedUserProfile.Settings.Add("localPreviewSize", cbLocalSize.Text);
            settings.SelectedUserProfile.Settings.Add("flickrDownloadBuddyIcons", cbBuddyIcons.Text);
            settings.ToDisk(HelperUtils.ApplicationPath + "\\settings\\PocketSettings.xml");
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}